<?php
// 开启session
session_start();

// 只支持POST请求，否则返回405错误
// if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
//    header('HTTP/1.1 405 Method Not Allowed');
//    return;
// }

// 清除自动登录remember-token
$_SESSION['logout'] = true;

if (isset($_SESSION['user'])) {
  unset($_SESSION['user']);
  unset($_SESSION['cart']);
}
header('Location:../index.php');
